package com.wlc.base.hashcodeandequal;

import java.util.HashMap;

/**
 * @author 王立朝
 * @date 2022/3/10
 * @description:
 */
public class Test1 {

    public static boolean check() {
        User1 user1 = new User1("zhangsan");
        //User1 user2 = user1;
        User1 user2 = new User1("zhangsan");
        System.out.printf("user1.hashCode() = %s, user 2.hashCode() = %s", user1.hashCode(), user2.hashCode());
        boolean equals = user1.checkHashCode(user2);
        System.out.println();
        System.out.println("user1.equals(user2) = " + equals);

        Boolean result2 = user1.checkHashCode(user2) && user1.equals(user2);


        return result2;
    }

    public void method02() {
        HashMap<String, Object> map = new HashMap();
        map.put("1", 2);
    }

    public static void main(String[] args) {
        boolean check = check();
        System.out.println("check = " + check);
    }
}
